<?php
/**
 * @version     1.0.0
 * @package     com_events
 * @copyright   Copyright (C) 2013. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 * @author      JORGE EDUARDO DE O LIVEIRA LUCIANO <jeolcavaco@hotmail.com> - http://jorgeeduardo.wordpress.com
 */
// no direct access
defined('_JEXEC') or die;

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.keepalive');

// Import CSS
$document = JFactory::getDocument();
$document->addStyleSheet('components/com_events/assets/css/events.css');
?>
<script type="text/javascript">
    js = jQuery.noConflict();
    js(document).ready(function(){
        
    });
    
    Joomla.submitbutton = function(task)
    {
        if(task == 'evento.cancel'){
            Joomla.submitform(task, document.getElementById('evento-form'));
        }
        else{
            
            if (task != 'evento.cancel' && document.formvalidator.isValid(document.id('evento-form'))) {
                
                Joomla.submitform(task, document.getElementById('evento-form'));
            }
            else {
                alert('<?php echo $this->escape(JText::_('JGLOBAL_VALIDATION_FORM_FAILED')); ?>');
            }
        }
    }
</script>

<form action="<?php echo JRoute::_('index.php?option=com_events&layout=edit&id=' . (int) $this->item->id); ?>" method="post" enctype="multipart/form-data" name="adminForm" id="evento-form" class="form-validate">
   <?php echo JLayoutHelper::render('joomla.edit.title_alias', $this); ?>
   
   <div class="form-horizontal">
   	<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'details')); ?>
   	
   	
   	<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'details', JText::_('COM_EVENTS_EVENT_DETAILS', true)); ?>
   	
   	<div class="row-fluid">
			<div class="span9">
				<div class="form-vertical">
				
					
					
					<?php echo $this->form->getControlGroup('local'); ?>
					<?php echo $this->form->getControlGroup('owner'); ?>
					
					<?php echo $this->form->getControlGroup('intro'); ?>
					
					<fieldset class="adminform">
						<?php echo $this->form->getControlGroup('content'); ?>
					</fieldset>
				</div>
   			</div>
			<div class="span3">
				<?php echo JLayoutHelper::render('joomla.edit.global', $this); ?>
			</div>
		</div>
		<?php echo JHtml::_('bootstrap.endTab'); ?>
		
		
		<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'publishing', JText::_('JGLOBAL_FIELDSET_PUBLISHING', true)); ?>
		<div class="row-fluid form-horizontal-desktop">
			<div class="span6">
				<?php echo $this->form->getControlGroup('datestart'); ?>
				<?php echo $this->form->getControlGroup('hourstart'); ?>
				
				<?php echo $this->form->getControlGroup('dateend'); ?>
				<?php echo $this->form->getControlGroup('hourend'); ?>
			</div>
			<div class="span6">
				<?php echo JLayoutHelper::render('joomla.edit.metadata', $this); ?>
			</div>
		</div>
		<?php echo JHtml::_('bootstrap.endTab'); ?>
		
		<?php if (JFactory::getUser()->authorise('core.admin','events')): ?>
			<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'acl', JText::_('ACL Configuration', true)); ?>
		
		
				<?php if (JFactory::getUser()->authorise('core.admin','events')): ?>
					<div class="fltlft" style="width:86%;">
						<fieldset class="panelform">
							<?php echo JHtml::_('sliders.start', 'permissions-sliders-'.$this->item->id, array('useCookie'=>1)); ?>
							<?php echo JHtml::_('sliders.panel', JText::_('ACL Configuration'), 'access-rules'); ?>
							<?php echo $this->form->getInput('rules'); ?>
							<?php echo JHtml::_('sliders.end'); ?>
						</fieldset>
					</div>
				<?php endif; ?>					
		
			<?php echo JHtml::_('bootstrap.endTab'); ?>
		<?php endif; ?>
		
		
		<?php echo JHtml::_('bootstrap.endTabSet'); ?>
   </div>
            
        <input type="hidden" name="task" value="" />
        <?php echo JHtml::_('form.token'); ?>

    </div>
</form>